﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using DAO;
namespace BUS
{
    public class ManagerBUS
    {
        public static List<MEMBER> GetAllManager()
        {
            try
            {
                return ManagerDAO.GetAllManager();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public static MEMBER GetManager(int IDManager)
        {
            try
            {
                bool isExisting = ManagerDAO.IsExisting(IDManager);
                if (!isExisting)
                    return null;
                MEMBER Manager=ManagerDAO.GetManager(IDManager);
                return Manager;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public static MEMBER GetManager(string UserName, string PassWord)
        {
            try
            {
                bool isExisting = ManagerDAO.IsExisting(UserName, PassWord);
                if (!isExisting)
                    return null;
                MEMBER Manager=ManagerDAO.GetManager(UserName, PassWord);
                return Manager;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public static bool updateMember(MEMBER _mMember)
        {
            try
            {
                bool isExist = ManagerDAO.IsExisting(_mMember.IDMEMBER);
                if (!isExist)
                    return false;
                return ManagerDAO.updateMember(_mMember);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}
